<?php


class myUser extends sfGuardSecurityUser 
{
      public function getCurrentGroupId()
      {
          $group_id = $this->getAttribute('current_group');

          if (!$group_id)
              {
                  $player = Doctrine_Core::getTable('GofishPlayer')->find($this->getGuardUser()->getId());
                  $group_id = $player->getGroupId();
              }

                                
           return $group_id;
      }
      
      public function getCurrentGroup()
      {
          $group = $this->getAttribute('group');

          if (!$group)
              {
                  $group = Doctrine_Core::getTable('GofishGroups')->find($this->getCurrentGroupId());
              }

                                
           return $group;
      }
      
      public function resetUserAttributes()
      {
           $this->setAttribute('current_group', '');
           $this->setAttribute('group', '');
      }

}
